<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<%@ include file="../../common/common.jsp" %>
<%@ include file="master_pass.jsp" %>
<HTML>
<HEAD>
<title>新建广告信息</title>
<%@ include file="../../common/meta.inc" %>
<link href="css.css" rel="stylesheet" type="text/css">
<base target="_self">
<SCRIPT LANGUAGE="javascript" SRC="${pageContext.request.contextPath}/scripts/common-validator.js"></SCRIPT>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/prototype.js"></script>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/buffalo/buffalo.js"></script>
<script language="javascript">
var END_POINT="${pageContext.request.contextPath}/buffalo";
var buffalo = new Buffalo(END_POINT);
function doSubmit() {

	form = document.theform;
	
	if(!validateForm(form))
		return;
		
    var obj = {};
	obj[Buffalo.BOCLASS] = "com.gouwudai.gobbs.pojo.TbbsAd";
	obj.title=$F('title');
	obj.url=$F('url');
	obj.type=parseInt($F('type'));
	obj.width=parseInt($F('width'));
	obj.height=parseInt($F('height'));
	obj.content=$F('content');
    buffalo.remoteCall("adServiceAjaxService.save",[obj], function(reply) {
        ajaxSubmit(reply.getResult(),"保存成功！","back");
    });
}

function validateForm(form)
{
    if(!sl_check(form.title,"广告标题",200,1)) return false;
    if(!sl_check(form.url,"URL",200,1)) return false;
    if(!sl_checkIntValue(form.width,"宽度",1000,1)) return false;
    if(!sl_checkIntValue(form.height,"高度",1000,1)) return false;
    return sl_confirmUpdate();
}
</script>
</HEAD>
<BODY>
<script language="javascript">
  setTitle("辅助工具","新建广告信息");
</script>
<form name="theform" method="post">
<table class="bluetable" width="100%">	
	<tr>
         <th colspan="2" align="right">新建广告信息</th>
    </tr>
	<tr>
		<td class="title" align="right">广告标题:</td>
		<td><input type="text" name="title" id="title" onkeydown="javascript:nextKeyPress(this)" size="20"></td>
	</tr>
	<tr>
		<td class="title" align="right">类型:</td>
		<td><select name="type" id="type">
	        <%=Arguments.getDictParamOptionsNo("A001",0) %>
	      	</select>
	     </td>
	</tr>
	<tr>
		<td class="title" align="right">URL:</td>
		<td><input type="text" name="url" id="url" onkeydown="javascript:nextKeyPress(this)" size="20"></td>
	</tr>
	<tr>
		<td class="title" align="right">宽度:</td>
		<td><input type="text" name="width" id="width" onkeydown="javascript:nextKeyPress(this)" size="10"></td>
	</tr>
	<tr>
		<td class="title" align="right">高度:</td>
		<td><input type="text" name="height" id="height" onkeydown="javascript:nextKeyPress(this)" size="10"></td>
	</tr>
	<tr>
		<td class="title" align="right">内容:</td>
		<td><textarea name="content" id="content" cols="50" rows="6"></textarea><script language="javascript">textAreaEx("content",6)</script>
		</td>
	</tr>																																		
</table>
<table  class="btntable" width="100%">
	<tr>
		<td>
		<button class="btn" accessKey=s id="btnSave" name="btnSave" onclick="javascript:doSubmit();">保存(<u>S</u>)</button>
		&nbsp;&nbsp;
		<button class="btn" accessKey=c id="btnCancel" name="btnCancel" onclick="javascript:history.back();">取消(<u>C</u>)</button>
		&nbsp;&nbsp;								
		</td>
	</tr>
</table>
</form>
</BODY>
</HTML>

